package com.share.feign;

import feign.Contract;
import feign.Logger;
import feign.QueryMapEncoder;
import feign.Retryer;
import feign.auth.BasicAuthRequestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @desc:
 * @author:caifan
 * @date:2020/6/13
 */
//@Configuration
public class FeignConfiguration {

    /**
     * 设置重试次数
     * @return
     */
    @Bean
    public Retryer retryer() {
        return new Retryer.Default(100, 1000, 5);
    }

    /**
     * 日志格式
     * @return
     */
    @Bean
    public Logger.Level logger() {
        return Logger.Level.FULL;
    }

    /* 使用这个要使用RequestLine
    @Bean
    public Contract feignContract() {
        return new feign.Contract.Default();
    }*/

    @Bean
    public BasicAuthRequestInterceptor basicAuthRequestInterceptor() {
        return new BasicAuthRequestInterceptor("root", "root");
    }

}
